package org.xxpay.pay.channel.quanming;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import org.springframework.util.Assert;
import org.xxpay.common.unify.AbstractPaymentConfig;


public class QuanminConfig extends AbstractPaymentConfig {
    public static final String CHANNEL_NAME = "quanmin";

    public static final String CHANNEL_NAME_WX_QR = CHANNEL_NAME+"_wx_qr";
    public static final String CHANNEL_NAME_ALI_QR = CHANNEL_NAME+"_ali_qr";
    public static final String CHANNEL_NAME_ysf = CHANNEL_NAME+"_ysf";

    public static final String RETURN_VALUE_SUCCESS = "1";
    public static final String RETURN_VALUE_FAIL = "0"; // 失败返回码
    public static final String RESPONSE_RESULT_SUCCESS = "success"; // 返回上游成功
    public static final String RESPONSE_RESULT_OK = "success"; // 返回上游成功
    public static final String RESPONSE_RESULT_FAIL = "fail";       // 返回上游失败

    public static final String REQ_PAY_URL_FIXX = "/pay";
    public static final String REQ_PAY_QUERY_URL_FIXX = "/pay/query";

    public static final String ORDER_STATUS_SUCCESS = "SUCCESS";
    public static final String ORDER_PAY_STATUS_SUCCESS = "1";

    QuanminConfig(String payParam){
        Assert.notNull(payParam, "init quanmin config error");
        JSONObject object = JSON.parseObject(payParam);
        setAppId(object.getString("appId"));
        setPrivateKey(object.getString("privatekey"));
        setRequestUrl(object.getString("requestUrl"));
        setPayMode(object.getString("payType"));
        setPrivateStorePathPwd(object.getString("md5key"));
        setPublicKey(object.getString("publickey"));
    }
}
